# udp_client.py
import socket

client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
client.sendto("你好，UDP服务端", ('localhost', 9999))  # 发送消息

data, _ = client.recvfrom(1024)
print("服务器回复：", data.decode())

client.close()
